import ajax from "./ajax"
import mockAjax from "./mockAjax"
// 2. 发送请求 获取三级分类列表的数据
export const reqCategoryListData = () => ajax.get('/product/getBaseCategoryList')

// 3.发送请求 获取楼层数据
export const reqGetBannerListData = () => mockAjax.get("/bannerList")

// 4.发送请求 获取轮播图数据
export const reqGetFloorListData = () => mockAjax.get("/floorList")

// 5.发送请求 获取 搜索页面数据
export const reqGetSearchListData = (searchParams) => ajax.post("/list", searchParams)
// 6.发送请求 获取 详情信息页面 数据
export const reqGetDetailData = (skuId) => ajax.get(`/item/${skuId}`)
// 7.发送请求 获取 添加到购物车 数据
export const reqAddOrUpdateData = (skuId, skuNum) => ajax.post(`/cart/addToCart/${skuId}/${skuNum}`)
// 8.发送请求 获取 购物车信息列表 数据
export const reqShopCartListData = () => ajax.get("/cart/cartList")
// 9.发送请求获取  修改购物车状态 的 数据
export const reqChangeShopCartInfoState = (skuID, isChecked) => ajax.get(`/cart/checkCart/${skuID}/${isChecked}`)
// 9. 批量更新购物车中商品的选中状态 
export const reqUpdateAllSkuInfoState = (isChecked, skuIdList) => ajax.post(`/cart/batchCheckCart/${isChecked}`, skuIdList)
// 10.删除购物车中一项数据
export const reqDelOnShopCartInfo = (skuId) => ajax.delete(`/cart/deleteCart/${skuId}`)
// 11.批量删除购物车中的数据    此接口有问题  
// export const reqDeleteSelectedCartInfo = (skuIdList)=>ajax.delete(`/cart/batchDeleteCart`,skuIdList)
export const reqDeleteSelectedCartInfo = (skuIdList) => ajax.post(`/cart/batchDeleteCart`, skuIdList)
// 12.获取验证码的请求
export const reqGetCode = (phone) => ajax.get(`/user/passport/sendCode/${phone}`)
// 13.注册用户账号的请求
export const reqUserRegister = (user) => ajax.post("/user/passport/register", user)
// 14.登录 请求
export const reqLogin = (userInfo) => ajax.post("/user/passport/login", userInfo)
// 15.退出登录请求
export const reqUserLogout = () => ajax.get("/user/passport/logout")
// 16.获取订单详情页面数据的请求
export const reqOrder = () => ajax.get("/order/auth/trade")
// 17.获取用户地址数据的请求
export const reqUserAdress = () => ajax.get("/user/userAddress/auth/findUserAddressList")
// 18.提交订单 的请求
export const reqSubmitOrder = (tradeNo, params) => {
  // console.log("1111111111111")
  return ajax.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, params)
}
// 19.获取订单支付信息
export const reqCreateNative =(orderId)=>ajax.get(`/payment/weixin/createNative/${orderId}`)
// 20.查询订单支付状态 
export const reqQueryPayStatus=(orderId)=>ajax.get(`/payment/weixin/queryPayStatus/${orderId}`)
// 21.获取我的订单列表 数据 的请求
export const reqUserOrderListData=(page,limit)=>ajax.get(`/order/auth/${page}/${limit}`)